package com.smartjobs.model;

import com.smartjobs.bean.EducationalQualificationBean;
import com.smartjobs.bean.JobseekerBean;
import com.smartjobs.bean.SkillsBean;
import com.smartjobs.bean.WorkExperienceBean;
import com.smartjobs.util.DBManager;

public class EditJSProfileModel {

	public static boolean UpdateBasicDetails(JobseekerBean jobseeker) {

		String query = "update smartjobs.jobseeker set emailId = '"
				+ jobseeker.getEmailID() + "', name= '" + jobseeker.getName()
				+ "', dob='" + jobseeker.getDob() + "', mobileNumber="
				+ jobseeker.getMobileNumber() + " where jobSeekerId= "
				+ jobseeker.getJobSeekerID();

		boolean result = DBManager.updateTable(query);
		return result;

	}

	public static boolean DeleteJSEQ(int eqID) {

		String query = "DELETE FROM smartjobs.educational_qual WHERE eqId = "
				+ eqID;
		boolean result = DBManager.deleteFromDB(query);
		return result;

	}

	public static boolean DeleteJSSkill(int jssID) {

		String query = "DELETE FROM smartjobs.jobseeker_skills WHERE jssId = "
				+ jssID;
		boolean result = DBManager.deleteFromDB(query);
		return result;

	}

	public static boolean DeleteJSWorkEx(int expID) {

		String query = "DELETE FROM smartjobs.experience WHERE expId = "
				+ expID;
		boolean result = DBManager.deleteFromDB(query);
		return result;

	}

	public static boolean InsertJSEQ(
			EducationalQualificationBean educationalQualification) {
		String query = "INSERT INTO smartjobs.educational_qual (degreeName, yearOfPass, aggregateMarks, jobSeekerId) VALUES ('"
				+ educationalQualification.getDegreeName()
				+ "', '"
				+ educationalQualification.getYearOfPassing()
				+ "', '"
				+ educationalQualification.getAggregateMarks()
				+ "', '"
				+ educationalQualification.getJobseekerID() + "')";

		boolean result = DBManager.insertIntoDB(query);
		return result;

	}

	public static boolean InsertJSSkill(SkillsBean skill) {

		String query = "INSERT INTO `smartjobs`.`jobseeker_skills` (`jobSeekerId`, `skillId`, `noOfMonths`) VALUES ('"
				+ skill.getJobseekerID()
				+ "', '"
				+ skill.getSkillID()
				+ "', '"
				+ skill.getMonths() + "')";

		boolean result = DBManager.insertIntoDB(query);		
		return result;

	}

	public static boolean InsertJSWorkEx(WorkExperienceBean workExperience) {
		String query = "INSERT INTO `smartjobs`.`experience` (`companyName`, `noOfYears`, `jobSeekerId`) VALUES ('"
				+ workExperience.getCompanyName()
				+ "', '"
				+ workExperience.getYears()
				+ "', '"
				+ workExperience.getJobseekerID() + "')";

		boolean result = DBManager.insertIntoDB(query);
		return result;

	}

}
